package com.cgx.tablet.beeper.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.cgx.tablet.beeper.R;
import com.cgx.tablet.beeper.adapter.viewholder.MainButtonViewHolder;
import com.cgx.tablet.beeper.bean.MainButtonBean;
import com.cgx.tablet.beeper.interfaces.OnItemClickListener;

import java.util.List;

/**
 * Created by Administrator on 2018/9/22 0022.
 */

public class MainButtonAdapter extends BaseRecycleViewAdapter<MainButtonBean, MainButtonViewHolder>{

    private OnItemClickListener onItemClickListener;
    private LayoutInflater layoutInflater;

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        this.onItemClickListener = onItemClickListener;
    }

    public MainButtonAdapter(Context context, @NonNull List<MainButtonBean> mData) {
        super(context, mData);
        layoutInflater = LayoutInflater.from(context);
    }

    @NonNull
    @Override
    public MainButtonViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new MainButtonViewHolder(layoutInflater.inflate(R.layout.item_main_button, parent, false), onItemClickListener);
    }
}
